package com.woniuxy.service.imp;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.woniuxy.mapper.UserMapper;
import com.woniuxy.pojo.User;
import com.woniuxy.service.UserService;

import lombok.Data;

@Data
@Service
public class UserServiceImp implements UserService {
    @Resource
    private UserMapper userMapper;

    @Override
    @Transactional
    public int addUser(User user) {
        int i = userMapper.add(user);
        if (i != 0) {
        // 返回id
        int number = userMapper.findUser_number();
        return number;
        }
        return i;
    }


	@Override
	public List<User> all() {

		return userMapper.all();
	}

	@Override
	public User findUserByNumber(int user_number) {
		return userMapper.findUserByNumber(user_number);
	}

	@Override
	public List<User> findAllByRole_name(String role_name) {
		return userMapper.findAllByRole_name(role_name);
	}


	@Override
	public User findUserByUser_phone(String User_phone) {
		return userMapper.findUserByUser_phone(User_phone);
	}


}
